package diamondServer.businesslogic.parser;

import diamondServer.businesslogic.resource.DefaultResRepository;
import diamondServer.businesslogic.resource.Resource;
import diamondServer.businesslogic.resource.ResourcesRepository;
import diamondServer.resources.Message;
import diamondServer.resources.MessageFake;
import diamondServer.resources.ServiceFake;

import junit.framework.TestCase;

public class ParserFakeTest
		extends TestCase
{
	private ResourcesRepository resRepository;
	private Parser parser;
	protected void setUp() throws Exception
	{
		resRepository = DefaultResRepository.getInstance();
		parser = new ParserFake(resRepository);
	}

	protected void tearDown() throws Exception
	{
		resRepository.removeAll();
	}

	public void testParse() throws ParseException
	{
		Message msg = new MessageFake();
		
		resRepository
			.addResource("ResourceFake", new Resource(msg, new ServiceFake()));
		Message parserResult = parser.parse("irrelevant string");
		
		assertTrue(msg == parserResult);	
	}

}
